package Client.Dropbox.Manager
import java.util.HashMap
import scala.reflect.BeanProperty

/**
 * Class that records details of the Dropbox
 */
class FileState {
  @BeanProperty 
  var root :String = _
  @BeanProperty 
  var user :Long = _ 
  @BeanProperty 
  var client : Long = _ 
  @BeanProperty 
  var port:Int = _ 
  @BeanProperty 
  var server:String = _
  @BeanProperty 
  var servPort:Int = _
  @BeanProperty
  var fhm=new HashMap[String, Long]
  @BeanProperty
  var idhm=new HashMap[Long,String]
  @BeanProperty
  var tagger:String = _
  
  /**
   * Add a path and an id to the hashmaps
   * @param path the path
   * @id the id
   */
  def add(path:String, id:Long)={fhm.put(path, id); idhm.put(id,path)}
  
  /**
   * Remove a pair from the hash map by the path
   * @param path the path to remove it by
   * @returns the matching id
   */
  def remove(path:String):Long={var id=fhm.remove(path).asInstanceOf[Long];idhm.remove(id);return id}
  
  /**
   * Remove a pair from the hash map by the id
   * @param id the id to remove it by
   * @returns the matching path
   */
  def remove(id:Long):String={var path=idhm.remove(id).asInstanceOf[String];fhm.remove(path);return path}
  
  /**
   * Get a folder id by its path
   * @param path the path
   * @return the matching id
   */
  def get(path:String):Long=fhm.get(path)
  
  /**
   * Get a folder path by its id
   * @param id the id
   * @returns the matching id
   */
  def get(id:Long):String=idhm.get(id)
}